<?php
//临时修改内存使用限制，没有限制
ini_set('memory_limit', -1);
$src = imagecreatefromjpeg('li_320_569.jpg');
$sw = imagesx($src);
$sh = imagesy($src);
$logo = imagecreatefrompng('logo.png');
$logow = imagesx($logo);
$logoh = imagesy($logo);

imagecolortransparent($logo, imagecolorallocatealpha($logo, 0, 0, 0, 127));
imagealphablending($logo,false);
imagesavealpha($logo,true);

$x = round(($sw - $logow) / 2);
$y = round(($sh - $logoh) / 2);
imagecopy($src, $logo, $x, $y, 0, 0, $logow, $logoh);

header('content-type:image/jpeg');
imagejpeg($src);
imagedestroy($src);
imagedestroy($logo);